package com.company.meituan2021;

import java.util.Scanner;

public class Main32 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[n];
        for (int i = 0; i < n; i++) {
            num[i] = sc.nextInt();
        }
        int[] bNum = new int[n];
        for (int i = 0; i < n; i++) {
            int temp = num[i];
            for (int j = 0; j < n; j++) {
                temp ^= ((i + 1) % (j + 1));
            }
            bNum[i] = temp;
        }
        int res = bNum[0];
        for (int i = 1; i < n ; i++) {
            res ^= bNum[i];
        }
        System.out.println(res);


    }
}

